-
Notifications
You must be signed in to change notification settings - Fork 32
🎨 Fix/enh: Avoid duplicated port compatibility calls #7803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a promise-based cache for port compatibility requests to avoid duplicate network calls when checking port compatibility between services.
- Switch calls to use the singleton instance method
getCompatibleInputs - Add
getCompatibleInputsmember inResources.jswith in-memory and persisted caching - Remove the old static
getCompatibleInputsand helper URL builder
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| services/static-webserver/client/source/class/osparc/utils/Ports.js | Updated to call getInstance().getCompatibleInputs instead of the static method |
| services/static-webserver/client/source/class/osparc/form/renderer/PropForm.js | Updated to call getInstance().getCompatibleInputs instead of the static method |
| services/static-webserver/client/source/class/osparc/data/Resources.js | Added new instance getCompatibleInputs with a promise cache and removed the old static implementation |
Comments suppressed due to low confidence (2)
services/static-webserver/client/source/class/osparc/data/Resources.js:1433
- [nitpick] The property name
__portsCompatibilityPromisesCachedis very long and uses double underscores. Consider renaming it to something clearer like_pendingPortsCompatibilityRequeststo improve readability.
__portsCompatibilityPromisesCached: null,
services/static-webserver/client/source/class/osparc/data/Resources.js:1729
- The new caching behavior isn't covered by existing tests. Add unit or integration tests to verify that (1) repeated calls with the same parameters return the cached result without making additional requests, and (2) different parameters still fetch new data.
getCompatibleInputs: function(node1, portId1, node2) {
|
@Mergifyio queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at 3b558ec |
sanderegg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
already looking forward to all this!
pcrespov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!



What do these changes do?
In the same spirit as #7802, this PR avoids duplicated port compatibility calls by keeping a promises cache.
Before:

After:

Related issue/s
How to test
Dev-ops